package com.shareroad.dubboweb.frame.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shareroad.dubboweb.frame.dao.data.DubboWebData;
import com.shareroad.dubboweb.frame.model.entity.MonitorInfoBean;
import com.shareroad.dubboweb.frame.service.MonitorService;

@Controller
public class FrameController {
	
	@Autowired
	private MonitorService monitorService;
	
	@RequestMapping({ "/index", "/clients" })
	public String clients(Model model) {
		model.addAttribute("clients", DubboWebData.getAllData());
		return "clients";
	}

	@RequestMapping("/test")
	public String test(Model model) {
		return "test";
	}
	
	@RequestMapping("/monitor")
	public String monitor(Model Model){
		return "monitor";
	}
	
	@ResponseBody
	@RequestMapping("/getMonitorInfo")
	public MonitorInfoBean getMonitorInfo(Model Model){
		return monitorService.getMonitorInfoBean();
	}

}
